<template>
    <div class="echart-chart">
        <div class="inside">
            <header><i class="el-icon-location-outline"></i> 买方卖方指数（本都会区）</header>
            <div class="chartBox clearfix" style="min-height: 100px;">
                <aside v-show="!chartNoDataShow">
                    <p>降价幅度：{{ isNull0(pct_price_cut) }}</p>
                    <p>在售天数：{{ isNull0(days_on_market, '天') }}</p>
                    <p>买方卖方指数：{{ isNull0(buyer_seller_index) }} <span>（数值越高代表市场越差）</span></p>
                    <p>本都市圈买家卖家指数：{{ isNull0(buyer_seller_index_metro) }}</p>
                </aside>
                <h4 ref="BuyerSellerIndex_Zip_NoData" v-show="chartNoDataShow"></h4>
            </div>
            <p v-show="false">{{getzipcode}}</p>

        </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                chartNoDataShow: false, //判断是否有无数据
                pct_price_cut: '', //降价幅度
                days_on_market: '', //在售天数
                buyer_seller_index: '', //买家卖家指数
                buyer_seller_index_metro: '', //本都市圈买家卖家指数

            }
        },
        computed: {
            //房源详情页图表使用——本房源所在邮zipcode
            getzipcode() {
                if(this.$store.getters.get_houseDetailsZipcode){
                    //获取买方卖方指数数据
                    this.get_BuyerSellerIndex_Zip();
                }
                return this.$store.getters.get_houseDetailsZipcode
            },

        },
        created() {
        },
        mounted() {
        },
        methods: {
            //获取买方卖方指数数据
            get_BuyerSellerIndex_Zip() {
                this.$get('/analysis/buyerSeller/1/'+ this.$store.getters.get_houseDetailsZipcode).then(res => {
                    if (res.status == 0) {
                        if(res.data != null){
                            this.chartNoDataShow = false;
                            this.pct_price_cut = res.data.pct_price_cut ? (res.data.pct_price_cut).toFixed(2) +'%' : 0;
                            this.days_on_market = res.data.days_on_market;
                            this.buyer_seller_index = res.data.buyer_seller_index ? res.data.buyer_seller_index.toFixed(2) : 0;
                            this.buyer_seller_index_metro = res.data.buyer_seller_index_metro ? res.data.buyer_seller_index_metro.toFixed(2) : 0;
                        }else{
                            this.chartNoDataShow = true;
                            this.$refs.BuyerSellerIndex_Zip_NoData.innerText = '暂未查询到数据！';
                        }
                    } else {
                        this.chartNoDataShow = true;
                        this.$refs.BuyerSellerIndex_Zip_NoData.innerText = res.msg;
                    }
                });
            },
        },
        components: {}
    }
</script>

<style scoped lang="less" type="text/less">
</style>
